<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>FCKContextMenu - Test Page</title>
   	<script type="text/javascript">

// Used by fckconfig
var FCK = new Object() ;

// Used by FCKPanel.
var FCKFocusManager = {
	Lock : function() {},
	Unlock : function() {}
} ;

	</script>
	<script src="../../../editor/_source/fckconstants.js" type="text/javascript"></script>
	<script src="../../../editor/_source/fckjscoreextensions.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fckbrowserinfo.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fckconfig.js" type="text/javascript"></script>
	<script src="../../../editor/lang/en.js" type="text/javascript"></script>
	<script src="../../../fckconfig.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fcktools.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckiecleanup.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckicon.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckpanel.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckmenuitem.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckmenublock.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckmenublockpanel.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckcontextmenu.js" type="text/javascript"></script>
	<script type="text/javascript">

var FCK_IMAGES_PATH = '../../../editor/images/' ;		// Check usage.
var FCK_SPACER_PATH = '../../../editor/images/spacer.gif' ;

FCKConfig.SkinPath = '../../../editor/skins/default/' ;

function LoadScript( url )
{
	document.write( '<script type="text/javascript" src="' + url + '"><\/script>' ) ;
}
var sSuffix = /msie/.test( navigator.userAgent.toLowerCase() ) ? 'ie' : 'gecko' ;
LoadScript( '../../../editor/_source/internals/fcktools_' + sSuffix + '.js' ) ;

	</script>
	<script type="text/javascript">

if ( FCKBrowserInfo.IsIE )
	FCK.IECleanup = new FCKIECleanup( window ) ;

// Includes the skin CSS in the main page.
document.write( '<link href="' + FCKConfig.SkinPath + 'fck_editor.css" type="text/css" rel="stylesheet">' ) ;

var oContextMenu ;

window.onload = function()
{
	oContextMenu = new FCKContextMenu( window, 'ltr' ) ;
	oContextMenu.SetMouseClickWindow( window ) ;
	oContextMenu.OnBeforeOpen = ContextMenu_OnBeforeOpen ;
	oContextMenu.OnItemClick = ContextMenu_OnItemClick ;

	oContextMenu.AttachToElement( document.getElementById( 'xRed' ) ) ;
	oContextMenu.AttachToElement( document.getElementById( 'xGreen' ) ) ;
	oContextMenu.AttachToElement( document.getElementById( 'xBlue' ) ) ;
}

var sLastOpened ;

function ContextMenu_OnBeforeOpen( targetElement )
{
	if ( targetElement.id == sLastOpened )
		return ;

	sLastOpened = targetElement.id ;

	this.RemoveAllItems() ;

	switch( targetElement.id )
	{
		case 'xRed' :
			this.AddItem( 'Insert Red' ) ;
			this.AddItem( 'Copy Red' ) ;
			var oItem = this.AddItem( 'I like Red' ) ;
				oItem.AddItem( 'My Red 1' ) ;
				oItem.AddItem( 'My Red 2' ) ;
			this.AddSeparator() ;
			this.AddItem( 'Diving in the Red Sea', null, '../_common/smiley.gif'  ) ;
			break ;

		case 'xGreen' :
			this.AddItem( 'My Green'			, null, [ '../_common/strip.gif', 16, 1 ] ) ;
			this.AddItem( 'Another Green'	, null, [ '../_common/strip.gif', 16, 3 ] ) ;
			this.AddSeparator() ;
			this.AddItem( 'More Green' ) ;
			break ;

		case 'xBlue' :
			this.AddItem( 'Blue Ocean' ) ;
			this.AddSeparator() ;
			this.AddItem( 'The sky is also blue', null, null, false, true, true ) ;
			this.AddItem( 'What about the Blues?' ) ;
			break ;
	}
}

function ContextMenu_OnItemClick( item )
{
	alert( item.Name ) ;
}

	</script>
</head>
<body>
	<div align="center">
		Right click on the following boxes. You must have a different context menu for each
		one one them.<br />
		<br />
		<table cellspacing="20" cellpadding="0" border="1">
			<tr>
				<td>
					<div id="xRed" style="width: 100px; height: 100px; background-color: #ff0000;">
						This is a <a href="#">link</a>.
					</div>
				</td>
				<td id="xGreen" style="width: 100px; height: 100px; background-color: #00ff00;">
					&nbsp;
				</td>
				<td id="xBlue" style="width: 100px; height: 100px; background-color: #0000ff;">
					&nbsp;
				</td>
			</tr>
		</table>
	</div>
	<p>
		<input type="checkbox" onclick="oContextMenu.CtrlDisable = this.checked" /> [CTRL] + [Right Click] always shows the default menu.
	</p>
</body>
</html>
